package com.tj.shopping.service.impl;

import com.tj.shopping.entity.Admin;
import com.tj.shopping.entity.Goodstype;
import com.tj.shopping.mapper.AdminMapper;
import com.tj.shopping.mapper.GoodstypeMapper;
import com.tj.shopping.service.IGoodsdetailService;
import com.tj.shopping.service.IGoodstypeService;
import com.tj.shopping.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import javax.servlet.annotation.WebServlet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GoodstypeServiceImpl implements IGoodstypeService {
    private GoodstypeMapper mapper;
    @Override
    public Map<String, Object> findall() {
        SqlSession session = MybatisUtil.getSession(true);
        mapper = session.getMapper(GoodstypeMapper.class);
        List<Goodstype> list1 = mapper.findall();

        Map<String,Object> map1 = new HashMap<>();
        if (null == list1 || list1.isEmpty()){
            map1.put("code",600);
            map1.put("msg","暂无数据");
        } else {
            map1.put("code",200);
            map1.put("msg","成功");
            map1.put("data",list1);

        }
        MybatisUtil.close(session);
        return map1;
    }
}
